package jpademo.controller;

import java.util.List;

import jpademo.model.Student;
import jpademo.service.StudentService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/students")
public class studentController {
    @Autowired
    private StudentService studentService;
    @RequestMapping(value = "/find/name/{name}")
    public List<Student> getStudentByName(@PathVariable String name)
    {
        List<Student> students = studentService.findByName(name);
        return students;
    }
    
    @RequestMapping(value = "/nameAndscore/{name}/{score}" 
	)
	public List<Student> findByNameAndScore(@PathVariable String name, @PathVariable float score) {
    	List<Student> students = studentService.findByNameAndScore(name, score);
        return students;
	}
}






